using System;
using System.Collections.Generic;
using System.Text;

namespace QuanLyKhachSan.DTO
{
    public class LoaiKhachHangDTO
    {
        // Cac thuoc tinh
        private int maLoaiKH;
        private string tenLoai;
        private float  heSoNhan;
        private int danhDau;

        // Cac phuong thuc
        public int DanhDau
        {
            get { return danhDau; }
            set { danhDau = value; }
        }
        public float HeSoNhan
        {
            get { return heSoNhan; }
            set { heSoNhan = value; }
        }
        public string TenLoai
        {
            get { return tenLoai; }
            set { tenLoai = value; }
        }
        public int MaLoaiKH
        {
            get { return maLoaiKH; }
            set { maLoaiKH = value; }
        }
        // Kiem tra du lieu
        static public bool KiemTraTenLoaiKhachHang(string tenLoaiKhachHang)
        {
            if (string.IsNullOrEmpty(tenLoaiKhachHang) == false)//neu no ko trong moi kiem tra tiep
            {
                // khong la so
                double kq;
                if (double.TryParse(tenLoaiKhachHang, out kq) == true)
                    return false;
                // Kiem tra giua 2 chu chi co khoang trang
                if (tenLoaiKhachHang.IndexOf("  ") != -1)
                    return false;
                int i;
                // Kiem tra co ki tu ~ hay khong
                for (i = 0; i < tenLoaiKhachHang.Length; i++)
                {
                    if (tenLoaiKhachHang[i] == '~')
                        return false;
                }
                // Kiem tra cac ky tu dau phai ky tu hoa
                string[] arr = tenLoaiKhachHang.Split(' ');

                for (i = 0; i < arr.Length; i++)
                {
                    if (char.IsLower(arr[i][0]) == true)
                        return false;
                }
            }
            return true ;
        }
        static public bool KiemTraHeSoNhan(string heSoNhan)
        {
            if (string.IsNullOrEmpty(heSoNhan) == false)
            {
                //Kiem tra he so nhan co la so thuc hay khong
                double kq;
                if (double.TryParse(heSoNhan, out kq) == false)
                    return false;
                else if (kq < 0)
                    return false;
                return true;
            }
            return true ;
        }
    }
}
